package per.turtle.common.core.annotation.validate;

import per.turtle.common.core.cofig.MaxSizeWithCharsetValidator;
import per.turtle.common.core.constant.CommonConstants;

import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

/**
 * @author turtle
 */
@Constraint(validatedBy = {MaxSizeWithCharsetValidator.class})
@Documented
@Retention(RUNTIME)
@Target({FIELD})
public @interface MaxSizeWithCharset {

    String charset() default CommonConstants.UTF8;

    int max() default Integer.MAX_VALUE;

    String message() default "";

    Class<?>[] groups() default {};

    Class<? extends Payload>[] payload() default {};

}
